#!/bin/bash

# JVM优化参数
JAVA_OPTS="-server -Xms2g -Xmx2g -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m"
JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20"
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heapdump.hprof"
JAVA_OPTS="$JAVA_OPTS -Dio.netty.leakDetectionLevel=disabled"

# 文件描述符限制（需要root权限）
# ulimit -n 65535

echo "启动Socket聊天服务器..."
java $JAVA_OPTS -jar target/socketchat-0.0.1-SNAPSHOT.jar 